import 'package:dio/dio.dart';
// import 'dart:io';
import 'package:shop_study/config/service_url.dart';

// 获取首页主题内容
Future getHomePageContent() async {
  try {
    print('开始获取首页数据');
    Response response;
    Dio dio = new Dio();
    // 需要引入dart:io
    // dio.options.contentType =
    // ContentType.parse('application/x-www-form-urlencoded') as String;
    dio.options.responseType = ResponseType.plain;
    var formData = {};
    response = await dio.post(servicePath['homePageContent'], data: formData);
    if (response.statusCode == 200) {
      return response.data;
    } else {
      throw Exception('接口异常');
    }
  } catch (e) {
    return print('Error:==============$e');
  }
}
